<template>
  <div class="user-info">
    <div class="user-info-header border-bottom">
      <div class="back-icon" @click="goBack">
        <i class="el-icon-arrow-left">返回</i>
      </div>
      <div class="user-info-title">
        <p>我的信息</p>
      </div>
    </div>
    <div class="user-info-content">
      <div class="content-wrapper avatar-bar">
        <div class="content-item border-bottom">
          <div class="item-title item">
            <span>头像</span>
          </div>
          <div class="item-right item">
            <div class="avatar-form">
              <img src="@/assets/styles/image/avatar/avatar2.jpg" alt="">
            </div>
          </div>
        </div>
      </div>
      <div class="content-wrapper">
        <div class="content-item border-bottom">
          <div class="item-title item">
            <span>真实姓名</span>
          </div>
          <div class="item-right item">
            <div class="real-name-form">
              <span>梁大拽</span>
            </div>
          </div>
        </div>
      </div>
      <div class="content-wrapper " @click="dialogFormVisible = true">
        <div class="content-item border-bottom nickname-bar">
          <div class="item-title item">
            <span>昵称</span>
          </div>
          <div class="item-right item">
            <div class="nickname-form">
              <span ref="nick"> {{ this.nickname }}</span>
              <i class="el-icon-arrow-right"></i>
            </div>
          </div>
        </div>
      </div>
      <div class="content-wrapper">
        <div class="content-item border-bottom">
          <div class="item-title item">
            <span>性别</span>
          </div>
          <div class="item-right item gender-bar">
            <div class="gender-form">
              <el-select v-model="select"
                         slot="prepend"
                         popper-class="right-box"
                         placeholder="请选择">
                <el-option label="男" value="1"></el-option>
                <el-option label="女" value="2"></el-option>
              </el-select>
            </div>
          </div>
        </div>
      </div>
      <!--弹窗-->
      <el-dialog title="修改我的昵称" :visible.sync="dialogFormVisible" width="80%">
        <el-form :model="form">
          <el-form-item>
            <el-input v-model="nickname" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" size="mini" @click="comfirmChange">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  export default {
    name: "UserInfo",
    gender: '男',
    data() {
      return {
        input5: '',
        select: '',
        dialogFormVisible: false,
        nickname: '我就是狗剩先生啊',
        oldName: '',
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px'
      }
    },
    watch: {
      nickname () {
        this.oldName = this.nickname
        return this.oldName;
      }
    },
    methods: {
      goBack() {
        this.$router.push('/personal_index')
      },
      comfirmChange () {
        this.dialogFormVisible = false
      }
    }
  }
</script>

<style lang="stylus" scoped>
  .content-wrapper >>> .el-input__inner::placeholder {
    text-align right
  }
  .content-wrapper >>> .el-input__inner {
    width: 100%;
    text-align: right;
    padding: 0;
    border: 0;
    height: 20px;
    line-height: 20px;
  }
  .content-wrapper >>>  .el-input__suffix {
    display: none
  }
  /* header */
  .user-info-header {
    width: 100%;
    height: 50px;
    background: #fff;
  }
    .user-info-title,.back-icon {
      float: left;
      color: #666;
      text-align: center;
    }
    .back-icon {
      width: 20%;
      line-height: 50px;
      z-index: 2;
      color: #1989fa;
      font-size: 16px;
    }
    .user-info-title {
      width: 60%;
      line-height: 50px;
      font-size: 18px;
    }
    .user-info-title p {
      margin: 0;
    }
  /* 信息内容 */
  .user-info-content {
    border-top: 6px solid #f8f8f8;
  }
  .content-item {
    display: flex;
  }
  .avatar-bar {
    border-bottom: 6px solid #f8f8f8;
  }
  .item {
    flex: 1;
    line-height: 0;
  }
  .content-item {
    padding: 10px 15px;
  }
  .item-title span {
    font-size: 15px;
    line-height: 22px;
    color: #666;
    font-family: Microsoft Yahei;
    font-weight: 500;
    padding-left: 12px;

  }
  .avatar-form {
    width: 15%;
    float: right;
    line-height: 0;
    padding-right: 12px;
  }
  .avatar-form img {
    width: 100%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;
  }
  .real-name-form {
    padding-right: 16px;
  }
  .real-name-form, .nickname-form, .gender-form {
    font-size: 16px;
    line-height: 20px;
    text-align: right;
    color: #333;
  }
  .nickname-bar {
    padding: 10px 10px 10px 15px;
  }
  .nickname-form i {
    font-size: 14px;
    color: #666;
    line-height: 22px;
  }
  .gender-bar {
    padding-right: 16px;
  }
  /* 弹出框 */
  .el-dialog__wrapper >>> .el-form-item{
    margin-bottom 0
  }

</style>
